package pt.uma.gap.ast;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;




/**
 * @author Duarte Abreu
 *
 */
public class ClassASTInfo {

	private PackageDeclaration packageDeclaration;
	private TypeDeclaration typeDeclaration;
	private List<MethodASTInfo> methodInfoList = new ArrayList<MethodASTInfo>();
	
	private List<FieldASTInfo> fieldInfoList = new ArrayList<FieldASTInfo>();
	
	
	
	public ClassASTInfo(PackageDeclaration packageDeclaration) {
		this.packageDeclaration = packageDeclaration;
	}
	
	public String getPackageName() {
		return packageDeclaration.getName().toString();
	}

	public String getClassName() {
		return typeDeclaration.getName().toString();
	}
	public void setTypeDeclaration(TypeDeclaration typeDeclaration) {
		this.typeDeclaration = typeDeclaration;
	}
	public List<MethodASTInfo> getMethodInfoList() {
		return methodInfoList;
	}
	public void setMethodInfoList(List<MethodASTInfo> methodInfoList) {
		this.methodInfoList = methodInfoList;
	}
	
	public void addMethodInfo(MethodASTInfo methodInfo){
		this.methodInfoList.add(methodInfo);
	}
	
	
	public List<FieldASTInfo> getFieldInfoList(){
		return fieldInfoList;
	}

	
	/**
	 * @param node
	 */
	public void addVariableDeclarationFragment(VariableDeclarationFragment node) {
		fieldInfoList.add(new FieldASTInfo());
		fieldInfoList.get(fieldInfoList.size() -1).setVariableDeclaration(node);
		
	}

	/**
	 * @param node
	 */
	public void addFieldDeclaration(FieldDeclaration node) {
		fieldInfoList.get(fieldInfoList.size() -1).setFieldDeclaration(node);
		
	}

	
	
	
}
